home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
t3_1
/
apollot.lha
/
apollot_sr10
/
tfix5.t
< prev
next >
Wrap
Text File
|
1989-03-17
|
5KB
|
136 lines
(herald tfix5 (env tsys)
(syntax-table (env-syntax-table t-implementation-env)))
(load-if-present '(tsystem ofix5) orbit-env)
;; scheme eof fix, throw fix, iob-writable? fix
(*define (*value standard-env 'scheme-env) 'eof eof)
(define (continuation-throw sp stack vals k-state base-state)
(cond ((stack? stack)
(let ((a (swap *the-current-throw-value* vals))
(b (swap *the-current-throw-frame* stack)))
(unwind-to-top)
(set *the-current-throw-frame* b)
(set *the-current-throw-value* a)
(set (process-global task/dynamic-state) k-state)
(invoke-continuation sp stack vals base-state k-state)))
(else
(error "throwing ~s to bad continuation ~s" vals stack))))
(define (unwind-to-top)
(iterate loop ((state (process-global task/dynamic-state)))
(cond ((eq? state nil))
((eq? (state-winder state) false)
(loop (state-previous state)))
(else
(perform-unwind state)
(loop (state-previous state))))))
(define-integrable (iob-writable? iob)
(or (iob-mode? (iob-mode iob) iob/write)
(iob-mode? (iob-mode iob) iob/append)))
(define (init-buffer buf mode underflow overflow)
(set (iob-mode buf) mode)
(set (iob-offset buf) 0)
(set (iob-h buf) 0)
(set (iob-prev-h buf) 0)
(set (iob-v buf) 0)
(set (iob-indent buf) 0)
(set (iob-wrap-column buf) standard-wrap-column)
(set (iob-line-length buf) standard-line-length)
(set (iob-rt buf) '#f)
(set (iob-eof-flag? buf) '#f)
(cond ((iob-readable? buf)
(set (iob-limit buf) 0)
(set (iob-underflow buf) underflow)
(set (iob-overflow buf) overflow-error))
((iob-writable? buf)
(set (iob-limit buf) (max-buffer-length buf))
(set (iob-underflow buf) underflow-error)
(set (iob-overflow buf) overflow)))
buf)
(define (CLOSE-PORT iob)
(let ((iob (enforce iob? iob)))
(cond ((iob-permanent? iob)
(nc-error "attempt to close a permanent port - ~a" iob))
((iob-closed? iob)
(no-value))
(else
(if (iob-writable? iob) (%vm-write-buffer iob))
(if (iob-channel iob) (%vm-close-file iob))
;++(set (table-entry open-port-table iob) nil)
(release-buffer-text %buffer-pool iob)
(set (iob-buffer iob) '#f)
(set (iob-mode iob) iob/closed)
(set (iob-xeno iob) '#f)
;; make it fail in VM-READ-CHAR
(set (iob-limit iob) -1)
(no-value)))))
(define (make-default-herald filename)
(let ((h (make-herald)))
(set (herald-filename h) (->filename filename))
h))
(*define (*value standard-env 'scheme-env) 'true true)
(define (read-inline-comment port ch n rt)
(ignore ch n rt)
(let ((readc (if (iob? port) vm-read-char read-char)))
(labels (((error)
(read-error port "end of file within #|...|# (missing delimiter)"))
((loop level)
(let ((ch (readc port)))
(cond ((eof? ch) (error))
((char= ch #\|)
(let ((ch (readc port)))
(cond ((eof? ch) (error))
((charn= ch #\#)
(unread-char port)
(loop level))
((fx= level 1)
nothing-read)
(else
(loop (fx- level 1))))))
((char= ch #\#)
(let ((ch (readc port)))
(cond ((eof? ch) (error))
((char= ch #\|)
(loop (fx+ level 1)))
(else
(unread-char port)
(loop level)))))
(else (loop level))))))
(loop 1))))
(set-dispatch-syntax read-dispatch #\| read-inline-comment)
(*define (*value standard-env 'scheme-env) 'cond-=>-aux cond-=>-aux)
;; from mohr-eric@yale.arpa march 1989
(define aegis-fs?
(let ((specials '(\/\/ \/ \. \\ \~)))
(object (lambda (fs) (eq? (fs-type fs) aegis-fs?))
((special-symbols self) specials)
((massage-logical-name self ln)
(let ((ln-string (string-downcase (symbol->string ln))))
(cond ((memq? ln specials)
ln-string)
(else
(string-append "~/" ln-string "/")))))
((parse-filespec self fs string)
(ignore fs)
(string->filename string #\/ #\.))
((print self port)
(format port "#{File-system-type~_AEGIS}")))))
(define (the-init-file-directory) "~/")